package com.sf.fy.uav.applet.operate.controller;

import com.sf.fy.uav.common.utils.Rs;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

/**
 * @author 01430312
 */
@RestController
@RequestMapping("/home/wx/")
@RequiredArgsConstructor
@Tag(name = "获取微信相关信息", description = "获取微信相关信息")
public class SysWxController {


    @Value("${app.version:1.0.7}")
    private String lastAppVersion;


    @GetMapping("/get-newly-release-status")
    @Operation(tags = "获取最新过审状态", description = "获取最新过审状态")
    public Rs<Integer> getReleaseStatus(@RequestParam String appVersion) {
        if (appVersion.compareTo(lastAppVersion) < 0) {
            //以前过审的
            return Rs.success(-1);
        } else if (appVersion.compareTo(lastAppVersion) == 0) {
            //最新过审的
            return Rs.success(0);
        } else if (appVersion.compareTo(lastAppVersion) > 0) {
            //未过审的
            return Rs.success(1);
        }
        return Rs.success(null);
    }
}
